<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FIRST LEGO League na Slovensku - FLL na Slovensku</title>
<base href="http://www.fll.sk/" />
<link href="http://kempelen.ii.fmph.uniba.sk/letnaliga/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>

	<?php
		if ($this->session->userdata('logged_in') == 0 ) {
		
			redirect('projekt');
		
		}
	?>
	<h2>Letná liga tímov FLL</h2>
	<div id = 'Ahoj'>
	<?php
	
		echo 'Ahoj ';
		echo "<strong>";
		echo $this->session->userdata['name'], '</br>';
		echo '<br/><br/><center>'.$tabulka.'</center>'
	
	?>
	</div>
	<h3><a href="<?php echo site_url('archive_control'); ?>"> Archív </a></h3>
	<h3>Zadania</h3>
	
	<div id = 'zadania'>
	
	<ul>
	<?php
	$today = date("Y-m-d H:i:s");
	$rok = date ("Y");
	$cisloZadania = 0;
	
	foreach ($themes as $obj) {
		if (($obj->end > $obj->start) && ($obj->start <= $today) && ($obj->start >= $rok)){
			$cisloZadania = $cisloZadania + 1;
			?>
			<li><a href="<?php echo site_url("projekt/show_mission/{$obj->id}"); ?>"> <?php echo $cisloZadania,'.  '; echo $obj->name; echo '	(deadline: ',$obj->end, ')'; ?> </a></li>
			<?php
		}
		
	}
	if ($this->session->userdata['type']) {
	
	echo '</br><h3> Neaktívne zadania </h3>' ;
		
		foreach ($themes as $obj) {
			if (($obj->end == '0000-00-00 00:00:00') || ($obj->start > $today)) {
				?>
				<li><a href="<?php echo site_url("projekt/show_mission/{$obj->id}"); ?>"> <?php echo $obj->name; ?> </a></li>
				<?php
			}
		
		}
	}
	
	?>
	</ul>
	</div>
	
	
	
	<div id = 'pridaj_zadanie'>
	<?php
		if ($this->session->userdata['type']) {
			?>
			<a href="<?php echo site_url('assignment_control'); ?>"> Pridať zadanie </a>
			<?php
		}
	?>
	</div>
	
	<div id = 'solutions'>
	<h3>Riešenia: </h3>
		
		<?php
		$id_zadania = 0;
		foreach ($zad_id as $obj) {
		
			$id_zadania = $id_zadania + 1;
			
			?> </br> <?php

			echo $id_zadania, '. kolo: ';
			foreach ($solutions as $sol) {
				if ($sol->mid == $obj) {
				?>
				<li>
					<a href="<?php echo site_url("projekt/show_solution/{$sol->id}"); ?>"> 
						<?php 
							$q = $this->db->where('id', $sol->uid)
										  ->get('users');
							$usr = $q->result();
							
							echo $usr[0]->name;
							if ($sol->win) {
								echo " (Výherné riešenie)"; 
							}								
							
						?> 
					</a>
				</li>
				<?php			
				}
			}
			
		}
		?>

	
	</div>
	
	
	<?php
		if ($this->session->userdata('logged_in') != 0 ) {

		?>
		<div id = 'logout_butt'>
		<a href="<?php echo site_url('auth/logout'); ?>"> Logout </a>
		</div>
		<?php
		}
		?>
</body>
</html>